package leetcode.oldVersion;

import java.util.Arrays;

public class lc1 {
    public static int[] getIndex(int[] nums, int target) {
        int[] res=new int[2];
        for (int i = 0; i < nums.length; i++) {
            int diff = target - nums[i];
            for (int j = i + 1; j < nums.length; j++) {
                if (nums[j] == diff) {
                    res[0]=i;
                    res[1]=j;
                    break;
                }
            }
        }
        return res;
    }
    public static void main(String[] args) {
        int[] nums1 = {2,7,11,15};
        int target1 = 9;
        System.out.println(Arrays.toString(getIndex(nums1, target1)));

        int[] nums2 = {3,2,4};
        int target2 = 6;
        System.out.println(Arrays.toString(getIndex(nums2, target2)));

        int[] nums3 = {3,3};
        int target3 = 6;
        System.out.println(Arrays.toString(getIndex(nums3, target3)));
    }
}
